package poo.sphere.controller;

import java.awt.Frame;
import java.awt.TextField;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;

import poo.sphere.modele.Sphere;
import poo.sphere.view.SphereWindow;

public class SphereController implements TextListener {
	private SphereWindow vueSphere;
	private Sphere modeleSphere;
	
	public SphereController(SphereWindow vueSphere){
		this.vueSphere=vueSphere;
	}
	
	@Override
	public void textValueChanged(TextEvent e) {
		TextField t=(TextField)e.getSource();
		double rayon=Double.parseDouble(t.getText());
		this.modeleSphere=new Sphere(rayon);
		this.vueSphere.setVolume(this.modeleSphere.getVolume());
		this.vueSphere.setSurface(this.modeleSphere.getSurface());
	}
	

}
